package com.testAll;

import com.alibaba.fastjson.JSON;
import com.core.jdbc.SqlHelper;
import com.core.util.CommonUtil;

import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author liujian
 * @email v_vjiannliu@tencent.com
 * @date 2022/3/15 15:30
 */
public class testCompareCarLife {
    public static void main(String[] args) throws Exception {
        compare();
    }

    public static void compare() throws Exception {

        String dcacheJson = CommonUtil.readJsonFile("C:\\Users\\v_vjiannliu\\Desktop\\useraccunew\\data\\carlife.json");

        List<String> jsonList = JSON.parseArray(dcacheJson, String.class);


        String dcacheJson2 = CommonUtil.readJsonFile("C:\\Users\\v_vjiannliu\\Desktop\\useraccunew\\data\\carlife" +
                ".json");

        List<String> jsonList2 = JSON.parseArray(dcacheJson2, String.class);
        int cout = 0;
        while (true) {
            //String userid = Arrays.asList(json.split("\\|")).get(0);
            if (cout == jsonList.size()) break;
            if (!jsonList.get(cout).equals(jsonList2.get(cout))) {
                System.out.println("有差异 " + jsonList.get(cout) + jsonList2.get(cout));
            }
            cout++;

        }
        System.out.println(jsonList.size());

        System.out.println(jsonList2.size());


    }

    public static void test2() {
        String json = CommonUtil.readJsonFile("C:\\Users\\v_vjiannliu\\Desktop\\useraccunew\\data\\pub.json");
        Map<String, Object> jsonResult = JSON.parseObject(json);
        //System.out.println(jsonResult);
        List<Map<String, Object>> list = (List<Map<String, Object>>) jsonResult.get("RECORDS");
        System.out.println(list);
    }


}
